package com.le.tester.javaThink.fourth.concurrency;

/**
 * createTime：2021/12/24 16:29
 * description：chops share use
 */

public class Chopstick {
    private boolean taken = false;

    public synchronized void take() throws InterruptedException {
        while (taken)
            wait();
        taken = true;
    }

    public synchronized void drop() {
        taken = false;
        notifyAll();
    }
}
